package database.tree;

public class Key implements Comparable<Key> {
	private String keyString;
	// this member is for both of leaf node and internal node
	private int recordId;
	private boolean isDel;
	// this member is for internal node
	private Node node;

	public Key() {
		this.keyString = "";
		this.recordId = -1;
		this.node = null;
		this.isDel = false;
	}

	public Key(String keyString) {
		this.keyString = keyString;
		this.recordId = -1;
		this.node = null;
		this.isDel = false;

	}

	public Key(String keyString, int rId) {
		this.keyString = keyString;
		this.recordId = rId;
		this.node = null;
		this.isDel = false;
	}

	public Node getNode() {
		return node;
	}

	public void setNode(Node node) {
		this.node = node;
	}

	public boolean isDel() {
		return isDel;
	}

	public void setDel(boolean isDel) {
		this.isDel = isDel;
	}

	// getter and setter
	public String getKeyString() {
		return keyString;
	}

	public void setKeyString(String keyString) {
		this.keyString = keyString;
	}

	public int getRecordId() {
		return recordId;
	}

	public void setRecordId(int recordId) {
		this.recordId = recordId;
	}

	@Override
	public int compareTo(Key o) {
		return this.keyString.compareTo(o.getKeyString());
	}
}
